<template>
	<div style="width=200px">
		<el-form ref="form" :rules="rules" :model="form" label-width="120px">


			<el-form-item label="姓名" prop="name">
				<el-input v-model="form.name"></el-input>
			</el-form-item>
			<el-form-item label="性别" prop="gender">
				
				
				 <el-select v-model="form.gender" placeholder="请选择">
				    <el-option
				      v-for="item in options"
				      :key="item.value"
				      :label="item.label"
				      :value="item.label">
					<!-- <el-input v-model="form.status"></el-input> -->
					  
				    </el-option>
				  </el-select>
			</el-form-item>
			<el-form-item label="年龄" prop="age">
				<el-input v-model="form.age"></el-input>
			</el-form-item>
			<el-form-item label="员工类别" prop="employeeType">
				<el-select v-model="form.employeeType" placeholder="请选择">
				   <el-option
				     v-for="item in options2"
				     :key="item.value"
				     :label="item.label"
				     :value="item.label">
								
				   </el-option>
				 </el-select>
				
			</el-form-item>
				<el-form-item label="入职时间" prop="entryTime">
					<span class="entryTime"></span>
					    <el-date-picker
					      v-model="form.entryTime "
					      type="date"
						  value-format="yyyy-MM-dd"
						  
					      placeholder="选择日期">时间
					    </el-date-picker>
					
				</el-form-item>
			</el-form-item>
	
			<el-form-item label="职务" prop="position">
				<el-input v-model="form.position"></el-input>
			</el-form-item>
			<el-form-item label="职称" prop="jobTitle">
				<el-input v-model="form.jobTitle"></el-input>
			</el-form-item>
				<el-form-item label="人员状态" prop="personnelStatus">
				 <el-select v-model="form.personnelStatus" placeholder="请选择">
				    <el-option
				      v-for="item in options1"
				      :key="item.value"
				      :label="item.label"
				      :value="item.label">
					<!-- <el-input v-model="form.status"></el-input> -->
					  
				    </el-option>
				  </el-select>
			</el-form-item>
			<el-form-item label="简介" prop="introduction">
				<el-input v-model="form.introduction"></el-input>
			</el-form-item>

			<el-form-item label="备注" prop="notes">
				<el-input v-model="form.notes"></el-input>
			</el-form-item>

			<el-form-item>
				<el-button type="primary" plain @click="save">保存数据</el-button>

			</el-form-item>
		</el-form>
		
	</div>
</template>

<script>
	export default {
		name: 'StaffManagement',
		components: {

		},
		props: [
			'show',
			'editid'
		],
		data() {
			return {
				form: {
					name: '',
					gender: '',
					age: '',
					employeeType: '',
					entryTime: '',
					position: '',
					jobTitle: '',
					personnelStatus: '',
					introduction: '',
					notes: '',
				
				},
				options: [{
				        value: '选项1',
				        label: '男'
				      }, {
				        value: '选项2',
				        label: '女'
				      }], 

				options1: [{
				        value: '选项1',
				        label: '离职'
				      }, {
				        value: '选项2',
				        label: '在职'
				      },
					  {
					    value: '选项2',
					    label: '其他'
					  }], 
				options2: [{
				        value: '选项1',
				        label: '医生'
				      }, {
				        value: '选项2',
				        label: '护工'
				      },
					  {
					    value: '选项2',
					    label: '健康管家'
					  }], 

				rules: {

					name: [{
							required: true,
							message: '类别名不能为空',
							trigger: 'blur'
						},
						{
							min: 1,
							max: 100,
							message: '长度在 1 到 100 个字符',
							trigger: 'blur'
						}
					]
				},

				life_remind: [],
				depts: [],
			}
		},
		
		
		created() {
			if (this.editid) {
				this.show = true;
				this.$axios.get(
					'staffManagement/getById',
					response => {
						this.form = response.obj
						
					}, 
					{id: this.editid })
			}
		},
		methods: {
			save() {
				this.axios.get('/staffManagement/add', (data) => {
					if (data) {
						this.$emit('update:show', false)
						this.$emit('getData')
					}

				}, this.form, '保存成功');
			},
			update(){
				this.axios.get('/staffManagement/update', (data) => {
					if (data) {
						this.$emit('update:show', false)
						this.$emit('getData')
					}
				
				}, this.id,this.status,'更新成功');
				
			}
			
		}

	}
</script>

<style>
</style>
